﻿using Iworld.Basis.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Iworld.Author.Model
{
    /// <summary>
    /// 用户金币变化记录
    /// </summary>
    public class GoldChangeRecord : RecordingTimeModelBase
    {
        /// <summary>
        /// 所属用户
        /// </summary>
        public virtual Author Owner { get; set; }

        /// <summary>
        /// 分变类型,比如投注,赠送,充值等等
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 收入
        /// </summary>
        public double Income { get; set; }

        /// <summary>
        /// 支出
        /// </summary>
        public double Expenses { get; set; }

        /// <summary>
        /// 实际变动
        /// </summary>
        public double Sum { set; get; }

        /// <summary>
        /// 当前余额
        /// </summary>
        public double Golds { get; set; }

        public GoldChangeRecord()
        {

        }

        public GoldChangeRecord(Author owner, string type, string description, double income, double expenses)
        {
            this.Owner = owner;
            this.Type = type;
            this.Description = description;
            this.Income = income;
            this.Expenses = expenses;
            this.Sum = this.Income - this.Expenses;
            this.Golds = this.Owner.Golds + this.Sum;
        }

    }
}
